<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!doctype html>
<html>
<head>
    <%@ include file="/common.jsp" %>
    <title>固定金额收款码生成</title>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/phone.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/css/demos.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/aui/css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx }/css/weui.min.css"/>
</head>

<body>
<section class="aui-content">
    <form action="${ctx}/auth/submitFixedMoneyQRCode" method="post" id="submitFMonQRCode" enctype="multipart/form-data">
        <input type="hidden" id="merchantNo" value="${merchant.merchantNo}" name="merchantNo">
        <input type="hidden" id="bankId" name="bankId" value="${bankInfo.id}">
        <input type="hidden" id="userId" name="userId" value="${merchant.cashiersId}">
        <ul class="aui-list">
            <li class="aui-list-item   ">
                <div class="aui-list-item-inner">
                    <img src="${ctx}/lookImage?filePath=${merchant.logo}&imgSize=400x100" style="height:70px ;width: 90%">
                </div>
            </li>
            <li class="aui-list-item   ">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-media" style="width: 6rem;">所属店铺</div>
                    <div class="aui-list-item-inner  ">${merchant.shopname}</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-media" style="width: 6rem;">所属用途</div>
                    <div class="aui-list-item-inner">
                        ${bankInfo.useDesc}
                    </div>
                </div>

            </li>
            <li class="aui-list-item   ">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-media" style="width: 6rem;">所属用户</div>
                    <div class="aui-list-item-inner">
                        ${merchant.name}/${merchant.loginMobilephone}
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-media" style="width: 6rem;">金额</div>
                    <div class="aui-list-item-inner  ">
                        <input type="text" id="payMoney" name="payMoney" onkeyup="validateAmount(this)" maxlength="8" placeholder="请输入收款码金额">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-media" style="width: 6rem;">收款说明</div>
                    <div class="aui-list-item-inner  ">
                        <input type="text" id="payremark" name="payremark" maxlength="15" placeholder="请输入收款说明">
                    </div>
                </div>
            </li>
        </ul>
    </form>
</section>

<section class="aui-content" style="margin-top: 14px; padding-left: 20px; padding-right: 20px;">
    <p>
    <input type="button" class="aui-btn aui-btn-info  aui-btn-block" id="buttonQrzf" onclick="createQrCode()" value="生成固额收款码"/>
    </p>
</section>


<!-----------------请选择所属用途-----弹层---------------->
<div id="dialogs">
    <div class="js_dialog" id="iosDialog2" style="display: none;">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__bd" id="DialogMessage"></div>
            <div class="weui-dialog__ft">
                <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary DeleteDefault">确定</a>
            </div>
        </div>
    </div>
</div>
<!-----------------请选择所属用户-----弹层---------------->
<script type="text/javascript">
    //错误提示弹框
    var $iosDialog2 = $('#iosDialog2');
    $('#dialogs').on('click', '.DeleteDefault', function () { //取消按钮事件
        $(this).parents('.js_dialog').fadeOut(200);
    });
    var oldVal = "";
    function validateAmount(obj) {
        var objVal = $(obj).val();
        var isNum = /^\d{1,8}([.]\d{0,2})?$/;
        if (objVal != "" && !isNum.test(objVal)) {
            $(obj).val(oldVal);
        } else {
            oldVal = objVal;
        }
    }

    function createQrCode() {
        $("#buttonQrzf").attr({ disabled: "disabled" });
        var payMoney = $("#payMoney").val();//金额
        var payremark = $("#payremark").val();//收款码说明
        if (payMoney == null || payMoney == '') {
            $("#buttonQrzf").removeAttr("disabled");
            $("#DialogMessage").html("请输入支付金额");
            $iosDialog2.fadeIn(200);
            return;
        }
        if(payMoney == 0){
            $("#buttonQrzf").removeAttr("disabled");
            $("#DialogMessage").html("支付金额需大于0");
            $iosDialog2.fadeIn(200);
            return;
        }
        if (payremark.trim().length == 0) {
            $("#DialogMessage").html("请输入收款码说明!");
            $iosDialog2.fadeIn(200);
            $("#buttonQrzf").removeAttr("disabled");
            return;
        }
        $("#submitFMonQRCode").submit();
    }
</script>

</body>
</html>